//
//  ViewController.m
//  DropdownChooseDemo
//
//  Created by Felix on 14-3-22.
//  Copyright (c) 2014年 xxyyzz. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    self.view.backgroundColor = [UIColor whiteColor];
    
    chooseItems = [[NSArray alloc]initWithObjects:
                   [NSArray arrayWithObjects:@"不限条件",@"条件1",@"条件2",@"条件3",@"条件4",@"条件5", nil],
                   [NSArray arrayWithObjects:@"不限国度",@"中国",@"米国",@"岛国",@"大清国",@"大宋国",@"星星国",@"阿里国", nil],
                   [NSArray arrayWithObjects:@"不限",@"男",@"女",@"不男不女", nil],nil];
    
    DropDownChooseView *chooseView = [[DropDownChooseView alloc]initWithFrame:CGRectMake(0, 20, 320, 44) dataSource:self delegate:self];
    chooseView.mSuperView = self.view;
    [self.view addSubview:chooseView];

}

#pragma mark - DropDownChooseView dataSoure and Delegate
-(NSInteger)numberOfSections{
    return [chooseItems count];
}

-(NSInteger)numberOfRowsInSection:(NSInteger)section{
    return [[chooseItems objectAtIndex:section] count];
}

-(NSString *)titleInSection:(NSInteger)section index:(NSInteger)index{
    return [[chooseItems objectAtIndex:section] objectAtIndex:index];
}

-(NSInteger)defaultShowIndexInSection:(NSInteger)section{
    return 0;
}

-(void)choosedAtSection:(NSInteger)section index:(NSInteger)index{
    NSLog(@"choosed at section:%d index:%d, content:%@",section,index,[[chooseItems objectAtIndex:section] objectAtIndex:index]);
}



- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
